/******************************************************************************
 * @Filename     : qspi.h
 *
 * @Version      : V1.0
 * @Subversion   : $
 * @Last modified: 04/30/2020 16:01:41
 * @Modified by  : Mxy
 *
 * @Brief        : QSPI driver header file
 *
 * Copyright (C) 2020 SKYRELAY Technology co.,Ltd All rights reserved.
 *****************************************************************************/
#ifndef __RC2412_QSPI_H__
#define __RC2412_QSPI_H__


#ifdef __cplusplus
extern "C"
{
#endif

#include "../../periph_def/rc2412_qspi_def.h"




enum qspi_status_t {
    QSPI_OK = 0,
    QSPI_BUSY,
    QSPI_ERROR,
    QSPI_PARA_ERROR,
};
	
typedef enum
{
	  QSPI_STANDARD        = 0x00ul,     /* single */
	  QSPI_DUAL_INPUT      = 0x01ul,     /* dual input */
	  QSPI_DUAL_OUTPUT     = 0x02ul,     /* dual output */
	  QSPI_QUAD_INPUT      = 0x03ul,     /* quad input */
	  QSPI_QUAD_OUTPUT     = 0x04ul,     /* quad output */	
	  QSPI_OTHER           = QSPI_STANDARD,
} qspi_frame_mode_t;	
	
//QSPI API function
enum qspi_status_t qspi_Init(uint32_t ctrl_reg);
//QSPI_STANDARD RX and TX
enum qspi_status_t qspi_Receive(uint8_t *cmd_buf, uint8_t cmd_len, uint8_t *rx_buf, uint32_t rx_len);
enum qspi_status_t qspi_Transmit(uint8_t *cmd_buf, uint8_t cmd_len, uint8_t *tx_buf, uint32_t tx_len);
//DUAL or QUAD for RX and TX
enum qspi_status_t qspi_Receive_Enhanced(uint32_t *cmd_buf, uint8_t cmd_len, uint8_t *rx_buf, uint32_t rx_len, qspi_frame_mode_t qspi_mode);	
enum qspi_status_t qspi_Transmit_Enhanced(uint32_t *cmd_buf, uint8_t cmd_len, uint8_t *tx_buf, uint32_t tx_len, qspi_frame_mode_t qspi_mode);
//DUAL Fast or QUAD Fast for RX
enum qspi_status_t qspi_Receive_Enhanced_IO_First(uint32_t *cmd_buf, uint8_t cmd_len, uint8_t *rx_buf, uint32_t rx_len, qspi_frame_mode_t qspi_mode);
enum qspi_status_t qspi_Receive_Enhanced_IO(uint32_t *cmd_buf, uint8_t cmd_len, uint8_t *rx_buf, uint32_t rx_len, qspi_frame_mode_t qspi_mode);
enum qspi_status_t qspi_Receive_Enhanced_IO_DUAL(uint32_t *cmd_buf, uint8_t cmd_len, uint8_t *rx_buf, uint32_t rx_len, qspi_frame_mode_t qspi_mode);
//XIP Mode
enum qspi_status_t qspi_Enable_Xcode_Mode(uint32_t ctrl_reg);
enum qspi_status_t qspi_Disable_Xcode_Mode(void);






	
#endif


